<?php
class padSimAction extends backendAction
{
    public function _initialize() {
        parent::_initialize();
        $this->_name = 'pad_sim';
        $this->_mod = D('pad_sim');
    }
    public function _before_index() {  
       $this->list_relation = true;
       $this->assign('type',$_REQUEST['type']);
    }
    
    /**
     * 获取请求参数生成条件数组
     */
    protected function _search(){
        //生成查询条件       
        ($sim = $this->_request('sim', 'trim')) && $map['sim'] = array('like', '%'.$sim.'%'); 
        ($simSn = $this->_request('simSn', 'trim')) && $map['simSn'] = array('like', '%'.$simSn.'%'); 
        $this->assign('search', array(
            'sim'=>$sim,
            'simSn'=>$simSn,
        ));     
        if($_REQUEST['type']=='ajax'){
         $map['userId'] = "0"; 
       }                   
        return $map;
    }
    
    public function index_ajax(){
        
        $map = $this->_search();
        $map['userId'] = "0"; 
        $mod = D($this->_name);
        !empty($mod) && $this->_list($mod, $map);
        $this->assign('type','ajax');
        $response = $this->fetch();
        $this->ajaxReturn(1, '', $response);        
    }    
}

?>